﻿using S7.Net;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp11
{
    internal class PlcData
    {
        public float db8_dbd12;
        public short db8_dbw24;
        public void CheckPlcConnectState(Plc plc)
        {
     
            Task.Run(() =>
            {
                while (true)
                {
                    short start = db8_dbw24;
                    Thread.Sleep(1500);
                    short end = db8_dbw24;
                    Console.WriteLine("start=" + start + "    end=" + end);
                    if (start == end)
                    {
                        MessageBox.Show("通讯异常！请检查");
                        plc.Close();
                    }
                }
            });
        }
    }
}
